package org.web2024.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.web2024.dao.Result;
import org.web2024.dao.User;
import org.web2024.service.LoginService;
import org.web2024.service.UserService;


@RestController
public class Usercontroller {
    @Autowired
    UserService userService;

    @Autowired
    LoginService loginService;

    @PostMapping("/login")
    public Result login(@RequestBody User user) {
        return loginService.Login(user);
    }

    @PostMapping("/logout")
    public Result logout() {
        return loginService.Logout();
    }
    @PostMapping("updatepsw")
    public Result update(@RequestParam String oldpsw, @RequestParam String newpsw){

         return loginService.update(oldpsw,newpsw);

    }
}
